function concurrentRequests(urlArr, limit) {
    return new Promise(async (resolve, reject) => {
        while (urlArr.length) {
            let arr = urlArr.splice(0, limit)
            request(arr)
        }
        let index = 0
        let resArr = []
        let count = 0
        async function request(urls) {

            if (urls.length === 0) {
                resolve([])
                return
            }
            let i = index
            const url = urls[index]
            index++
            try {
                const res = await fetch(url)
                resArr[i] = res
            } catch (err) {
                resArr[i] = err
            } finally {
                count++
                if (count === urlArr.length) {
                    resolve(resArr)
                }
                request(urls)
            }
        }
    })
}

const urlArr = []
for(let i = 0; i < 100; i++) {
    urlArr.push('https://www.csdn.net/')
}
concurrentRequests(urlArr, 3).then(res => {
    console.log(res);
})